package com.wjs.spring.service;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class ServiceAspect {
    @Before("execution(* com.wjs.spring.service.Services.* (..))")
    public void ServiceBefore(){
        System.out.println("前置通知");
    }
    @AfterReturning("execution(* com.wjs.spring.service.Services.* (..))")
    public void ServiceAfterReturning(){
        System.out.println("后置通知");
    }
    @Around("execution(* com.wjs.spring.service.Services.*(..))")
    public void ServiceAround(ProceedingJoinPoint JoinPoint) throws Throwable {
        System.out.println("前置环绕通知");
        JoinPoint.proceed();
        System.out.println("后置环绕通知");
    }
}
